package com.polytech.models;

import java.util.Collection;
import java.util.Vector;

import javax.swing.AbstractListModel;

import com.polytech.beans.Car;

public class CarsModel extends AbstractListModel<Car>{

	private Vector<Car> cars;

	public CarsModel() {
		this.cars=new Vector<>();
	}

	
	
	public void addCar(Car car){
		cars.add(car);
	}
	
	
	public void addCars(Collection<Car> cars1){
		for (Car car : cars1) {
			addCar(car);
		}
	}

	@Override
	public Car getElementAt(int index) {
		assert index<cars.size():"index out of bounds !!";
		return cars.get(index);
	}

	@Override
	public int getSize() {
		
		return cars.size();
	}


	


	

}
